package unm.excel

class CollegeExcel extends AbstractExcel {
    String type
    String status
    String url
    String folderName
    String pageName
    String englishName
    String chineseName


    String getContentHtmlName() {
        "college/${folderName}/${pageName}.content.html"
    }

    static List<CollegeExcel> load() {
        def sheet = getSheet('college_data.xls', 'college')
        def lastRowNum = sheet.getLastRowNum() // begin at 0

        def list = []
        for (int i = 1; i <= lastRowNum; i++) {
            def row = sheet.getRow(i)
            def type = row.getCell(0)?.stringCellValue
            def status = row.getCell(1)?.stringCellValue
            def url = row.getCell(2)?.stringCellValue
            def folderName = row.getCell(3)?.stringCellValue
            def pageName = row.getCell(4)?.stringCellValue
            def englishName = row.getCell(5)?.stringCellValue
            def chineseName = row.getCell(6)?.stringCellValue
            list << new CollegeExcel(type: type, status: status, url: url,
                    folderName: folderName, pageName: pageName, englishName: englishName, chineseName: chineseName)
        }
        return list
    }
}
